<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('采购合同跟踪查询')" />
	<th:block th:include="include :: list-css" />
	<style type="text/css">
		.layui-tab-content{border: 1px solid;padding: 10px 15px;}
		.layui-tab-title li{font-weight:600}
		.layui-tab{margin:0}
	</style>
</head>
<body>
<div class="mid-content">
	<div class="layui-tab" lay-filter="dhtab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" listUrl="/business/orderprocess/list" listName="采购合同">合同明细</li>
	    <li listUrl="/business/in/list" listName="采购入库">采购入库</li>
	    <li listUrl="/business/paymentorder/list" listName="采购付款">采购付款</li>
	    <li listUrl="/business/paymentorderreturn/list" listName="采购退款">采购退款</li>
	    <li listUrl="/business/invoicein/list" listName="采购收票">采购收票</li>
	    <li listUrl="/business/invoiceinreturn/list" listName="采购退票">采购退票</li>
	  </ul>
	  <div class="layui-tab-content">
	    <table class="layui-hide" id="dhtable" lay-filter="ftable"></table>
	  </div>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: businessJS" />
<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = ctx + [[${prefix}]],
		bid=[[${bid}]],
		gridColumns=[[${gridColumns}]],
		business=[[${business}]];
	/*]]>*/
</script>
<script type="text/javascript">
$(".layui-tab-content").css("border-color",pellucidityTen)
var gridBodyMap=[];//表格列集合
gridBodyMap[0]=gridColumns.gridBody;//合同明细
gridBodyMap[1]=[//采购入库
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "iid", title: "行号"},	
	{width: 150, sort: true, field: "gDate", title: "入库日期"},
	{width: 150, sort: true, field: "gDepotName", title: "入库仓库"},
	{width: 150, sort: true, field: "gBrand", title: "品牌"},
	{width: 150, sort: true, field: "gSerial", title: "系列"},
	{width: 150, sort: true, field: "gID", title: "型号"},
	{width: 150, sort: true, field: "gName", title: "品名"},
	{width: 150, sort: true, field: "gIndex", title: "订货号"},
	{width: 150, sort: true, field: "gUnit", title: "单位"},
	{width: 150, sort: true, field: "bNumb", title: "入库数量", totalRow: true}
	]
gridBodyMap[2]=[//采购付款
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "dFkRq", title: "付款日期"},
	{width: 150, sort: true, field: "vFkYh", title: "付款银行"},
	{width: 150, sort: true, field: "vFkZh", title: "付款账号"},
	{width: 150, sort: true, field: "fCgJe", title: "采购金额", totalRow: true},
	{width: 150, sort: true, field: "fSumje", title: "付款金额", totalRow: true}
	]
gridBodyMap[3]=[//采购退款
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},	
	{width: 150, sort: true, field: "dTkRq", title: "退款日期"},
	{width: 150, sort: true, field: "vTkYh", title: "退款银行"},
	{width: 150, sort: true, field: "vTkZh", title: "退款账号"},
	{width: 150, sort: true, field: "fSumje", title: "退款金额", totalRow: true}
	]
gridBodyMap[4]=[//采购收票
	{fixed: "left", width: 40,type: "numbers"},
	{width: 200, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "dSpRq", title: "收票日期"},
	{width: 150, sort: true, field: "vFpXlh", title: "发票序列号"},
	{width: 150, sort: true, field: "vKdDh", title: "快递单号"},
	{width: 150, sort: true, field: "gBrand", title: "品牌"},
	{width: 150, sort: true, field: "gSerial", title: "系列"},
	{width: 150, sort: true, field: "gID", title: "型号"},
	{width: 150, sort: true, field: "gName", title: "品名"},
	{width: 150, sort: true, field: "gIndex", title: "订货号"},
	{width: 150, sort: true, field: "gUnit", title: "单位"},
	{width: 150, sort: true, field: "bNumb", title: "收票数量", totalRow: true},
	{width: 150, sort: true, field: "bPrice", title: "收票单价"},
	{width: 150, sort: true, field: "fSumje", title: "收票金额", totalRow: true}
	]
gridBodyMap[5]=[//采购退票
	{fixed: "left", width: 40,type: "numbers"},
	{width: 200, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "dTpRq", title: "退票日期"},
	{width: 150, sort: true, field: "vFpXlh", title: "发票序列号"},
	{width: 150, sort: true, field: "fSpJe", title: "收票金额", totalRow: true},
	{width: 150, sort: true, field: "fSumje", title: "退票金额", totalRow: true}
	]
var $,layer,form,element,table,wherestr={};
layui.use(['table','form','layer','jquery','element'], function () {
    $ = layui.$, layer = layui.layer, form = layui.form, table = layui.table, element = layui.element;
    $.tablelist.init({//默认加载合同明细
        elem: '#dhtable'
        ,url: prefix + '/list'
   	 	,where: {'bid':bid}
    	,even:true
        ,totalRow: true
        ,cols:[gridBodyMap[0]
	 	]
		,height:'full-100'
    });
	//监听排序事件 
    table.on('sort(ftable)', function(obj){
    	$.tablelist.sort('dhtable',obj);
    });
  	//双击行事件：查看单据
	table.on('rowDouble(ftable)', function(obj){
		var tabThis=$('.layui-tab-title').find('.layui-this'),//获取当前选中tab页dom节点
			tName=tabThis.attr('listName'),
			tUrl=tabThis.attr('listUrl');
		if(tName)parent.layui.index.openTabsPage(tUrl.replace('/group','').replace('list','edit?nid=')+obj.data.nid, tName+'('+obj.data.bid+')');
    });
	//监听Tab页
 	element.on('tab(dhtab)', function(data){
 		$.tablelist.init({//表格需重新初始化，重载会继承初始化的参数（不可行）
 			elem: '#dhtable',
 			url:$(this).attr('listUrl'),
 			even:true,
 			where:data.index>0?{'cgBid':bid}:{'bid':bid},
 	        height:'full-100',
 	       	totalRow: true,
			cols:[gridBodyMap[data.index]
			]
 		});
	});
 });
</script>
</body>
</html>